package com.alison.module.author.enums;

import com.alison.module.author.entity.User;

public enum UserSexEnum implements KeyValueEnum {
    MAN(1, "男"), WOMAN(2, "女");
    int code;
    String description;

    UserSexEnum() {
    }

    public static UserSexEnum of(int code) {
        for (UserSexEnum value : values()) {
            if (value.code == code) {
                return value;
            }
        }
        return null;
    }

    UserSexEnum(int code, String description) {
        this.code = code;
        this.description = description;
    }

    @Override
    public int getKey() {
        return this.code;
    }

    @Override
    public String getValue() {
        return this.description;
    }
}